package cn.hs.service.impl;

import cn.hs.entity.Course;
import cn.hs.entity.Publicity;
import cn.hs.entity.UserCourse;
import cn.hs.mapper.PublicityMapper;
import cn.hs.mapper.UserMapper;
import cn.hs.service.PublicityService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName PublicityServiceImpl
 * @Description TODO
 * @Author wsh
 * @Date 2024年10月23日 20:21
 * @Version 1.0
 */
@Service
public class PublicityServiceImpl implements PublicityService {
   @Autowired
    private PublicityMapper publicityMapper;


    @Override
    public PageInfo findAll(Integer pageNum, Integer pageSize, Publicity publicity) {
//
       //分页业务的实现
        PageHelper.startPage(pageNum,pageSize);
        List<Publicity> publicitys=publicityMapper.select(publicity);
        PageInfo<Publicity> pageInfo=new PageInfo<>(publicitys);
        return pageInfo;
    }

    @Override
    public List<Publicity> find(Publicity publicity) {
        return publicityMapper.select(publicity);
    }

    @Override
    public int insert(Publicity publicity) {
        return publicityMapper.insert(publicity);
    }

    @Override
    public int update(Publicity publicity) {
        return publicityMapper.update(publicity);
    }

    @Override
    public int delete(Integer id) {
        return publicityMapper.delete(id);
    }
}
